class CreateBoxes < ActiveRecord::Migration
  def self.up
    create_table :boxes do |t|
      t.column :name, :string, :limit => 128
      t.column :ip, :string, :limit => 20
    end
    if Box.count == 0 then
      Box.create! :name => 'pc_1.1', :ip => '192.168.65.1' #, :room_id => 1
      Box.create! :name => 'pc_1.2', :ip => '192.168.65.2' #, :room_id => 1
      Box.create! :name => 'pc_1.3', :ip => '192.168.65.3' #, :room_id => 1
      Box.create! :name => 'pc_1.4', :ip => '192.168.65.4' #, :room_id => 1
    end
  end

  def self.down
    drop_table :boxes
  end
end
